1. Field
The present embodiments relate to techniques for executing applications on computer systems. More specifically, the present embodiments relate to a method and system for executing web applications using hardware-accelerated graphics and native code modules.
2. Related Art
Computer systems often include a number of native applications that require complex three-dimensional (3D) scenes to be rendered, such as computer games and computer-aided design (CAD) systems. To render 3D scenes, these native applications may use graphics application programming interfaces (APIs) that direct calculations related to graphics rendering to dedicated graphics-processing units (GPUs). Furthermore, such native applications may include machine code that executes directly on one or more processors. The computational power provided by these processors and/or GPUs can greatly improve graphics quality and throughput.
Web applications, which have become more prevalent in recent years, are typically written in scripting languages that are unable to utilize low-level graphics APIs that provide graphics hardware acceleration. Instead, graphics rendering for web applications is typically performed by CPUs instead of GPUs. The software-based nature of web-based graphics rendering may thus limit the graphics capabilities of web applications. Furthermore, the interpreted nature of scripting languages may result in significantly slower execution times for web applications than for native applications. However, unlike native applications, web applications provide a number of advantages. For example, web applications are capable of executing on multiple platforms, do not require installation, and can be more secure than native applications. The tradeoff between web application security and native graphics performance may be addressed using a browser plugin that renders graphics for web applications by interfacing with a local graphics hardware device (e.g., a GPU). Such a plugin may correspond to a complex software system that includes various mechanisms for obtaining scene information from the web applications; storing the scene information; processing the scene information using transforms, effects, and shaders; and sending commands to the graphics hardware for rendering the scene. Furthermore, the processing demands of the plugin may require the plugin to be implemented using native code, which is traditionally insecure. Consequently, the plugin itself may include a number of potential security vulnerabilities that may be exploited by other applications and/or bugs that may lead to system failures.
Hence, what is needed is a mechanism for safely executing native code for web-based graphics rendering while maintaining communication between the native code and graphics hardware.